﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using BBECServiceBusAdapter_CodeGenLib.EditForms.Revenue;

namespace BBECServiceBusAdapter.Helper_Activities.Inbound
{

    public sealed class ProcessPaymentEdit : CodeActivity
    {
        // Define an activity input argument of type string
        public InArgument<BBECServiceBusAdapter.ConstituentDataContractExtensions.PaymentDataContract> PaymentData { get; set; }
        public InArgument<Guid> RevenueGuid { get; set; }

        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            // Obtain the runtime value of the Text input argument
            //string text = context.GetValue(this.Data.).ToString;
            BBECServiceBusAdapter.ConstituentDataContractExtensions.PaymentDataContract inData = context.GetValue(this.PaymentData);
            Guid inRevenueGuid = context.GetValue(this.RevenueGuid);

            RevenueEditDataFormCustomData frmData = new RevenueEditDataFormCustomData();
            //frmData.ConstituentID = new Guid(inData.ConstituentID);
            frmData.RecordID = inRevenueGuid.ToString();
            frmData.Amount = inData.Amount;
            frmData.Description = inData.Description;
            frmData.Designation = inData.Designation;
            //frmData.ReceiptDate = inData.ReceiptDate;
            //frmData.LookupID = inData.ID;
            //frmData.PaymentMethod = inData.PaymentMethod;
            //frmData.PostDate = inData.PostDate;
            //frmData.RevenueDate = inData.RevenueDate;


            frmData.Save(new Blackbaud.AppFx.WebAPI.AppFxWebServiceProvider(Blackbaud.AppFx.Workflow.CatalogActivities.WebApiUtility.GetAppFxWebApiProvider(context).ConnectionString));
        }
    }

}
